home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGIALS
/
PTUTOR2B.LZH
/
ENTYPES.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-01-15
|
2KB
|
56 lines
(* Chapter 8 - Program 1 *)
program Enumerated_Types;
type Days = (Mon,Tue,Wed,Thu,Fri,Sat,Sun);
Time_Of_Day = (Morning,Afternoon,Evening,Night);
var Day : Days;
Time : Time_Of_Day;
Regular_Rate : real;
Evening_Premium : real;
Night_Premium : real;
Weekend_Premium : real;
Total_Pay : real;
begin (* main program *)
Writeln('Pay rate table':33);
Writeln;
Write(' DAY Morning Afternoon');
Writeln(' Evening Night');
Writeln;
Regular_Rate := 12.00; (* This is the normal pay rate *)
Evening_Premium := 1.10; (* 10 percent extra for working late *)
Night_Premium := 1.33; (* 33 percent extra for graveyard *)
Weekend_Premium := 1.25; (* 25 percent extra for weekends *)
for Day := Mon to Sun do begin
case Day of
Mon : Write('Monday ');
Tue : Write('Tuesday ');
Wed : Write('Wednesday');
Thu : Write('Thursday ');
Fri : Write('Friday ');
Sat : Write('Saturday ');
Sun : Write('Sunday ');
end; (* of case statement *)
for Time := Morning to Night do begin
case Time of
Morning : Total_Pay := Regular_Rate;
Afternoon : Total_Pay := Regular_Rate;
Evening : Total_Pay := Regular_Rate * Evening_Premium;
Night : Total_Pay := Regular_Rate * Night_Premium;
end; (* of case statement *)
case Day of
Sat : Total_Pay := Total_Pay * Weekend_Premium;
Sun : Total_Pay := Total_Pay * Weekend_Premium;
end; (* of case statement *)
Write(Total_Pay:10:2);
end; (* of "for Time" loop *)
Writeln;
end; (* of "for Day" loop *)
end. (* of main program *)